# coding:utf-8
"""
    @author : 计祝兵
    @date : 2024/6/5 10:43
    @file : __init__.py.py
    @desc : read 读取
"""

import xlrd

# 读取Excel
excel = xlrd.open_workbook('study.xlsx')

# 根据sheet的名称
book = excel.sheet_by_name('学生手册')
print(book)

# 根据sheet的索引
book = excel.sheet_by_index(0)
print(book)

# 遍历所有的sheet
for i in excel.sheets():
    print(i.name)

# 读取Excel中某个sheet的行和列数量
print(book.nrows)
print(book.ncols)

# 读取具体的内容
for i in book.get_rows():
    content = []
    for j in i :
        content.append(j.value)
    print(content)